package com.atguigu.test.dacahngmainshitidierji.lock;

import lombok.Getter;

/**
 * 2 * @Author: madonghui
 * 3 * @Date: 2020/11/11 11:34
 * 4
 */
public enum CountryEnum {
    ONE(1,"巴巴罗萨"),
    TWO(2,"基辅围歼战"),
    THREE(3,"库尔斯克"),
    FOUR(4,"列宁格勒"),
    FIVE(5,"莫斯科"),
    SIX(6,"斯大林格勒");

    @Getter private  Integer  retCode;
    @Getter private String retMessage;

    CountryEnum(Integer retCode, String retMessage) {
        this.retCode = retCode;
        this.retMessage = retMessage;
    }

    public static CountryEnum foreach_retMessage(Integer retCode){
        //获取enum的数组，底层就是一个map数据库
        CountryEnum[] values = CountryEnum.values();
        for (CountryEnum countryEnum : values) {
            if (countryEnum.getRetCode() == retCode){
                return countryEnum;
            }
        }
        return null;
    }

}
